//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <ctype.h>
#include <elatypes.h>

#ifdef  __cplusplus
extern "C" {
#endif

_ELASTOS_NAMESPACE_USING

//---- AChar ----
Boolean __cdecl _AChar_IsASCII(AChar ch)
{
    return !!__isascii(ch);
}

Boolean __cdecl _AChar_IsControl(AChar ch)
{
    return !!iscntrl(ch);
}

Boolean __cdecl _AChar_IsDigit(AChar ch)
{
    return !!isdigit(ch);
}

Boolean __cdecl _AChar_IsLeadByte(AChar ch)
{
    return !!isleadbyte(ch);
}

Boolean __cdecl _AChar_IsLetter(AChar ch)
{
    return !!isalpha(ch);
}

Boolean __cdecl _AChar_IsLetterOrDigit(AChar ch)
{
    return !!isalnum(ch);
}

Boolean __cdecl _AChar_IsLower(AChar ch)
{
    return !!islower(ch);
}

Boolean __cdecl _AChar_IsNumber(AChar ch)
{
    return !!isxdigit(ch);
}

Boolean __cdecl _AChar_IsPunctuation(AChar ch)
{
    return !!ispunct(ch);
}

//Boolean __cdecl _AChar_IsSeparator(AChar ch)
//{
//    assert(0);
//    return false;
//}

//Boolean __cdecl _AChar_IsSymbol(AChar ch)
//{
//    assert(0);
//    return false;
//}

Boolean __cdecl _AChar_IsUpper(AChar ch)
{
    return !!isupper(ch);
}

Boolean __cdecl _AChar_IsWhiteSpace(AChar ch)
{
    return !!isspace(ch);
}

AChar __cdecl _AChar_ToLower(AChar ch)
{
    return (AChar)tolower(ch);
}

AChar __cdecl _AChar_ToUpper(AChar ch)
{
    return (AChar)toupper(ch);
}

//---- WChar ----
Boolean __cdecl _WChar_IsASCII(WChar ch)
{
    return !!iswascii(ch);
}

Boolean __cdecl _WChar_IsControl(WChar ch)
{
    return !!iswcntrl(ch);
}

Boolean __cdecl _WChar_IsDigit(WChar ch)
{
    return !!iswdigit(ch);
}

Boolean __cdecl _WChar_IsLetter(WChar ch)
{
    return !!iswalpha(ch);
}

Boolean __cdecl _WChar_IsLetterOrDigit(WChar ch)
{
    return !!iswalnum(ch);
}

Boolean __cdecl _WChar_IsLower(WChar ch)
{
    return !!iswlower(ch);
}

Boolean __cdecl _WChar_IsNumber(WChar ch)
{
    return !!iswxdigit(ch);
}

Boolean __cdecl _WChar_IsPunctuation(WChar ch)
{
    return !!iswpunct(ch);
}

//Boolean __cdecl _WChar_IsSeparator(WChar ch)
//{
//    assert(0);
//    return false;
//}

//Boolean __cdecl _WChar_IsSymbol(WChar ch)
//{
//    assert(0);
//    return false;
//}

Boolean __cdecl _WChar_IsUpper(WChar ch)
{
    return !!iswupper(ch);
}

Boolean __cdecl _WChar_IsWhiteSpace(WChar ch)
{
    return !!iswspace(ch);
}

WChar __cdecl _WChar_ToLower(WChar ch)
{
    return (WChar)towlower(ch);
}

WChar __cdecl _WChar_ToUpper(WChar ch)
{
    return (WChar)towupper(ch);
}

#ifdef  __cplusplus
}
#endif
